<?php 
 $pageTitle = '收藏夹';
 $pageId="page-favorite-list";
?>

@extends('ios.pageIndex')

@section('page-content')
<div class="content-padded m-cart-list m-favorite-list">
	
	@if (count($favorites) == 0)
	<p>暂时没有收藏！</p>
	@else 
	<div class="list-block media-list no-padded font-normal" id="favorite-list">
	  <ul>
	    @foreach($favorites as $f)
		@if (!empty($f->product))
	     <li data-favorite_id = "{{$f->id}}"
        	data-id="{{$f->product->id}}"  data-name="{{$f->product->name}}" data-enname="{{$f->product->enname}}" 
            data-image="{{$f->product->image}}" data-price="{{$f->product->discount_price > 0 ? $f->product->discount_price : $f->product->price}}"
            data-size_id="{{$f->size_id}}" data-size="{{empty($f->sizeer) ? '' : $f->sizeer->size }}"
            data-color_id="{{$f->color_id}}" data-color="{{empty($f->colorer) ? '' : $f->colorer->color }}">
	      <a class="item-content border-bottom external" href="{{URL::to('product',$f->product->id)}}">
	        <div class="item-media"><img src="{{Images::url($f->product->image,72,72)}}" width="72" height="72"></div>
	        <div class="item-inner">
	          <div class="item-title-row top">
	            <div class="item-title">{{$f->product->brand}}</div>
	            <div class="item-after"><span class="action delete" href="#">&times;</span></div>
	          </div>
			  <div class="item-subtitle">{{$f->product->name}}</div>
			  @if (!empty($f->size))
	              <div class="item-subtitle">尺寸:{{$f->size}}</div>
	          @endif
	          @if (!empty($f->color))
	              <div class="item-subtitle">颜色:{{$f->color}}</div>
	          @endif
	          <div class="item-title-row bottom">
	            <div class="item-subtitle">价格：¥ {{$f->product->discount_price > 0 ? number_format($f->product->discount_price,2) : number_format($f->product->price,2)}} 元</div>
	            <div class="item-after product-fee">
	            	@if(!empty($f->size_id))
	            		@if(!empty($f->sizeer))
	            			<button href="#" class="button cart-button">加入购物车</button>
	            		@else
	            			<button href="#" class="button cart-button disable">已售完</button>
	            		@endif
	            	@elseif(!empty($f->color_id))
	            		@if(!empty($f->colorer))
	            			<button href="#" class="button cart-button">加入购物车</button>
	            		@else
	            			<button href="#" class="button cart-button disable">已售完</button>
	            		@endif
	            	@else
	            		@if($f->product->quantity > 0)
	            			<button href="#" class="button cart-button">加入购物车</button>
	            		@else
	            			<button href="#" class="button cart-button disable">已售完</button>
	            		@endif
	            	@endif
	            </div>
	          </div>
	        </div>
	      </a>
	    </li>
	    @endif
		@endforeach
	  </ul>
	</div>
	@endif
</div>
@stop